<?php

// No direct access
 
defined('_JEXEC') or die('Restricted access'); ?>
<div id="subHeader">
	<div class="login">
		<img alt="Sartu" src="<?php echo JURI::root();?>templates/lingolangtemplate/images/kandadoa.jpg">
		<div><a class="morea" href="index.php?option=com_user&view=login">Sartu zure kontuan</a></div>
	</div>
	<a id="img1" class="atalak gorria" href="index.php?option=com_hizkuntzak&task=whoSpeaks">
		<div class="atalText"><?php echo $this->rsc->menu_who; ?></div>
	</a>
	<a id="img2" class="atalak morea" href="index.php?option=com_hizkuntzak&task=showLangDetails">
		<div class="atalText "><?php echo $this->rsc->menu_first; ?></div>
	</a>
	<a id="img3" class="atalak laranja"href="index.php?option=com_hizkuntzak&task=qas">
		<div class="atalText"><?php echo $this->rsc->menu_qa; ?></div>
	</a>
	<a id="img5" class="atalak berdea" href="index.php?option=com_hizkuntzak&task=numbers">
		<div class="atalText"><?php echo $this->rsc->menu_numbers; ?></div>
	</a>
	<a id="img4" class="atalak current" href="index.php?option=com_hizkuntzak&task=songs">
		<div class="atalText"><?php echo $this->rsc->menu_songs; ?></div>
	</a>
</div>
<div id="left">
	<div id="menu">
		<ul>
		<?php
			$color = 0;
			$text_color = "gorria";
			foreach($this->langs as $la){
				if ($color == 0) {
					$text_color = "gorria";
					$color++;
				}else if($color == 1){
					$text_color = "morea";
					$color++;
				}else if ($color == 2) {
					$text_color = "laranja";
					$color++;
				}else if ($color == 3) {
					$text_color = "urdina";
					$color++;
				}else if ($color == 4) {
					$text_color = "berdea";
					$color = 0;
				}
				if($this->c_lang == 'eu-ES'){

					if ($la->iso_code == $this->lang->iso_code) {
						print("<li class='selected'><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_eu</a></li><br/>");# code...
					} else{
						print("<li ><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_eu</a></li><br/>");
					}
				}else{
					if ($la->iso_code == $this->lang->iso_code) {
						print("<li class='selected'><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_es</a></li><br/>");
					} else{
						print("<li ><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_es</a></li><br/>");
					}
				}
			};
		?>
		<?php
		if($this->show){
			?>
			<br/>
			<hr/>
			<br/>
			<a href="index.php?option=com_hizkuntzak&task=adminHizkuntzak" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
			<span class="ui-button-text"><?php echo $this->rsc->admin_title; ?></span></a>
		<?php }?>
		</ul>
	</div>
</div>
<div id="content">
	<?php
	if($this->show){
		?>
	<a href="index.php?option=com_hizkuntzak&task=createSongLang&"hlang"=<?php echo($this->lang->iso_code);?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
	<span class="ui-button-text"><?php echo $this->rsc->songs_new; ?></span></a>
	<br/>
	<br/>
	<hr/>
	<?php }?>
	<?php 
		if(count($this->songsLang)==0){
			?>
			<div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all"> 
				<p>
					<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
					<strong><?php echo($this->rsc->main_no_words);?></strong>
				</p>
			</div>
		<?php 
		}
		else{
		?>
		<div id="contleft">
			<ul>
			<?php
				foreach($this->songsLang as $song){
					if($this->c_lang == 'eu-ES'){
						echo("<h3><a href='#s$song->id' id='$song->id' name='s$song->id' class='songsLink'>$song->name_eu</a></h3>");
					}
					else{
						//echo("<input type='button' id='word' value='$word->word_es'/><br/>");
						echo("<h3><a href='#s$song->id' id='$song->id' name='s$song->id' class='songsLink'>$song->name_es</a></h3>");
					}
					echo("<input type='hidden' id='s$song->id-s' value='$song->spelling' />");
					echo("<input type='hidden' id='s$song->id-p' value='$song->pronoun' />");
					echo("<input type='hidden' id='s$song->id-v' value='$song->audioPath' />");
					if($this->show){
						echo('<a href="index.php?option=com_hizkuntzak&task=createSongLang&id='.$song->getId().'" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"> <span class="ui-button-text">'.$this->rsc->edit.'</span></a>');
					}
				}
			?>
			</ul>
		</div>

		<div id="contright">
				
				<video width="480" controls="controls" height="360" autoplay="autoplay" poster="<?php echo JURI::root();?>components/com_hizkuntzak/img/no-video.jpg" id="videoWord">
					<source id="srcwebm" src="<?php echo($this->songsLang[0]->audioPath);?>.webm" type="video/webm" />
					<source id="srcogg" src="<?php echo($this->songsLang[0]->audioPath);?>.ogg" type="video/ogg" />
					<source id="srcmp4" src="<?php echo($this->songsLang[0]->audioPath);?>.mp4" type="video/mp4" />
					<object id="srcobj" width="480" height="360" src="<?php echo($this->songsLang[0]->audioPath);?>.mp4" >
						<embed id="srcemb" width="480" height="360" src="<?php echo($this->songsLang[0]->audioPath);?>.flv" >
							<?php echo $this->rsc->no_support ?>: <a href="<?php echo($this->songsLang[0]->audioPath);?>.mp4" id="dfile"><?php echo $this->rsc->file ?></a>
						</embed>
						</object>
				</video>
				<div id="play_button">
					<a href="#" id="button_link" ><img src="<?php echo JURI::root();?>components/com_hizkuntzak/img/play.png" alt="Play"/></a>
				</div>
				<center>
					<p align="center" id='spelling'><?php echo($this->songsLang[0]->spelling);?></p>
					<p align="center" id='pronoun'><?php echo($this->songsLang[0]->pronoun);?></p>
				</center>
		</div>
	<?php
		} 
	?>
</div>
